import pinia from '@/store/index';
import {
	useloginStore
}
from '@/store/login';
const loginStore = useloginStore(pinia);


export const mixins = {
	data() {
		return {
			loginStore,
			userInfo: {},
		};
	},
	mounted() {
		this.userInfo = JSON.parse(JSON.stringify(loginStore.userInfo));
	},
	onShow() {
		const app = getApp();
		const modifyData = app.globalData.modifyData;
		if (modifyData) {
			console.log(modifyData, 'modifyData');
			if (["attended_schools"].includes(modifyData.type)) {
				this.userInfo = JSON.parse(JSON.stringify(loginStore.userInfo));
			}
			else {
        console.log('修改')
				this.userInfo[modifyData.type] = modifyData.value;
			}
		}
		setTimeout(() => {
			app.globalData.modifyData = null;
		}, 100);
	},
};